<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8"%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="js/jquery.min.js"></script>

    <link rel="stylesheet" type="text/css" href="css/login.css">
    <script type="text/javascript">
        $(function(){
            $("#username").change(function(){
                $.get("user","username="+this.value+"&method=check",function(data){
                    if(data==1){
                        $("#usernameMsg").html("用户名已经存在").css("color","red");
                        $("#registerBtn").attr("disabled",true);
                    }else{
                        $("#usernameMsg").html("用户名可用").css("color","green");
                        $("#registerBtn").removeAttr("disabled");
                    }
                })
            });
        })
    </script>
    <title>注册</title>
</head>
<body>
<form  method="post" action="user?method=register" class="form center" id="userLogin" >
    <div class="login">
        <div class="login_center">
            <div class="login_main center">
                <div class="username">
                    <div class="left fl">用户名:&nbsp;</div>
                    <div class="right fl">
                        <input class="shurukuang" type="text" name="username" id="username" value="${username}"  placeholder="请输入你的用户名"/>
                        <label id="nameMsg"></label>
                    </div>
                </div>
                <div class="username">
                    <div class="left fl">密&nbsp;&nbsp;&nbsp;&nbsp;码:&nbsp;</div>
                    <div class="right fl">
                        <input class="shurukuang" type="password" name="password"  id="pwd" value="${password}"  placeholder="请输入你的密码"/>
                    </div>
                </div>

                <div class="login_submit">
                    <input class="submit" type="submit" name="submit" value="注册" id="btn"  >
                </div>
                <span style="color:red">${msg}</span>
            </div>
        </div>
    </div>
</form>
</body>
</html>